<?php
/**
 * Project: AIGC
 * Author: moufer <moufer@163.com>
 * Date: 2024/7/6 09:34
 */

namespace module\ai\front\table;

use module\ai\library\channel\Factory;
use mof\enum\EnableEnum;
use mof\front\Table;

class ChannelTable extends Table
{
    protected string $serverBaseUrl  = '/{module}/admin/{table}';
    protected array  $toolbarButtons = ['refresh'];
    protected bool   $tableSelection = false;
    protected bool   $showSearch     = false;
    protected bool   $showPagination = false;
    protected string $pk             = 'id';
    protected int    $pageSize       = 100;
    protected string $sort           = 'asc';

    protected function columnId(): array
    {
        return [
            "prop"  => 'id',
            "label" => 'ID',
        ];
    }

    protected function columnFlag(): array
    {
        return [
            "prop"    => 'flag',
            "label"   => '平台',
            "type"    => 'select',
            "width"   => 140,
            "options" => Factory::platformDict('config')->toElementData()->toSelectOptions()
        ];
    }

    protected function columnName(): array
    {
        return [
            "prop"  => 'name',
            "label" => '通道名称',
            "width" => '*',
            "align" => "left"
        ];
    }

    protected function columnStatus(): array
    {
        return [
            "prop"    => 'status',
            "label"   => '状态',
            "type"    => "select",
            "width"   => 100,
            "options" => EnableEnum::toDict()->toElementData()->toSelectOptions()
        ];
    }

    protected function columnCreateAt(): array
    {
        return [
            "prop"  => 'update_at',
            "label" => '新建时间',
            "type"  => "datetime",
            "width" => 200
        ];
    }

    protected function columnUpdateAt(): array
    {
        return [
            "prop"  => 'update_at',
            "label" => '更新时间',
            "type"  => "datetime",
            "width" => 200
        ];
    }

}